using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using EpubLibrary;
using System.Diagnostics;
using EpubLibrary.Image;
using HtmlAgilityPack;
using System.Windows.Forms;

namespace TestEpubLibrary
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
//            EpubFactory.create("FirstBook.epub", "D:\\outbooks\\",  @"<p>My agloritm of extracting useful data is:</p>
//<ol>       <img src='http://www.crazyleafdesign.com/blog/wp-content/uploads/2008/09/cool-wallpapers-for-designers-11.jpg' />
//<li>Get root node (body tag) and put it for processing to recursively procedure that begins at step 2.</li>
//
//<li>Calculate length of clear text in node.</li>
//<li>Get list of subnodes for node.</li>
//<li>If there is only 1 subnode then go to step 2 to process this subnode.</li>
//<li>For each subnode calculate length of clear text in the subnode.</li>
//<li>Get coefficient (K) of distribution of a text between subnodes.</li>
//<li>If K is low (&lt;5%) it means that text is uniformly distributed between sobnodes and current node is exact main content of the page.</li>
//<li>If K is not low (&gt;=5%) then choose the subnode with longest clear text , and apply the same procedure for this subnode (go to step 2). There is recursive call of content extracting function.</li>",
//        false, true, 200);

            //Size size = ImageHeader.GetDimensions("http://www.crazyleafdesign.com/blog/wp-content/uploads/2008/09/cool-wallpapers-for-designers-11.jpg");
            //System.Console.WriteLine(size.Width);
            //System.Console.WriteLine(size.Height);

            //Process.Start("cd C:\\Program Files\\Calibre2");
            //string s = "\"C:\\Program Files\\Calibre2\\ebook-convert.exe\" C:\\listCategory.html C:\\e.epub";
            //System.Console.WriteLine(s);
            //Process p = Process.Start(s);
            //p.Start();
            

            //Process p = new Process();
            //p.StartInfo.WorkingDirectory = @"C:\\Program Files\\Calibre2\\ebook-convert.exe";
            //p.StartInfo.FileName = @"ebook-convert.exe";
            //p.StartInfo.CreateNoWindow = false;
            //p.StartInfo.Arguments = @"C:\listCategory.html C:\e.epub";
            //p.Start();
            //p.WaitForExit();

            //EpubFactory.extractMainContentOfWebPage("http://htmlagilitypack.codeplex.com/");
            //EpubFactory.extractMainContentOfWebPage("http://baodatviet.vn/Home/phapluat/hosovuan/Ba-bau-chet-tham-vi-gan-100-vet-dam/201110/174273.datviet");

            // Forum Gateway - Powered by DnP Firewall: http://forum.zing.vn/fanfiction/ui-rui-ui-tui-la-con-gai-ma-dung-nham-tui-la-con-trai-chu/t835775.html 
            //EpubFactory.extractMainContentOfWebPage("http://forum.zing.vn/fanfiction/ui-rui-ui-tui-la-con-gai-ma-dung-nham-tui-la-con-trai-chu/t835775.html");
            //EpubFactory.extractMainContentOfWebPage("http://kenh14.vn/c87/20111103011749568/phai-roi-do-la-tinh-yeu.chn");
            //EpubFactory.extractMainContentOfWebPage("http://baodatviet.vn/Home/phapluat/hosovuan/Ba-bau-chet-tham-vi-gan-100-vet-dam/201110/174273.datviet");
            //string url = "http://dailyinfo.vn/view1/link1.html";
            //Uri baseUri = new Uri(url);
            //Uri uri = new Uri(baseUri, "../images1/test.jpg", true);
            //System.Console.WriteLine(uri.AbsoluteUri);

            //Uri uri1 = new Uri(baseUri, "http://dailyinfo.vn/view1/images1/test.jpg", true);
            //System.Console.WriteLine(uri1.AbsoluteUri);


            //EpubFactory.extractMainContentOfWebPage("http://kenh14.vn/c87/2011102512033294/mang-ve-mot-nguoi-ban.chn");
            //string s = EpubFactory.extractMainContentOfWebPage("http://vnthuquan.net/truyen/truyen.aspx?tid=2qtqv3m3237nvnnn0n0nqn31n343tq83a3q3m3237nvn");
            //string s = EpubFactory.extractMainContentOfImagesPage("http://truyen18.org/doctruyen/sekirei/chapter-116/58201.html", 300);
            //Readability ability = new Readability(false, false, false, ReadingStyle.Newspaper, ReadingMargin.Medium, ReadingSize.Medium);
            //HtmlNode node = ability.getContent(Content.LoadContent("http://vnexpress.net/gl/the-gioi/2012/06/thong-qua-luat-bien-la-hoat-dong-lap-phap-binh-thuong/"),false);

            //Close();
        }
    }
}